<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>优雅的使用数组</title>
</head>
<body>
</body>
<script>
    const arr = [
        { id: 1, name: 'ironman' },
        { id: 2, name: 'black_widow' },
        { id: 3, name: 'captain_america' },
        { id: 4, name: 'captain_america' },
    ];
     function fillterFunc(name){
         return (item) =>item.name===name;
     }
     console.log(arr.filter(fillterFunc("captain_america")))
    console.log(arr.find(fillterFunc("captain_america")))
    let sum = arr.reduce(function(pev,cur,index,arr){
            pev.push(cur.name)
            return pev
    },[])


</script>
</html>